<?php

namespace Lib\Dao;
use Illuminate\Support\Facades\DB;

class FcfDao{
		
	static function select($queryString){
		try {
			return DB::select($queryString);
		} catch (\Exception $e) {
			LogsDao::nuevo("Error->".__FUNCTION__,$e->getMessage());
			return $e->getMessage();
		}
	} 
	
	static function selectRow($queryString){
		try {
			$result = DB::select($queryString);
			if(!empty($result)){
				return $result[0];
			}else{
				return false;
			}			
		} catch (\Exception $e) {
			LogsDao::nuevo("Error->".__FUNCTION__,$e->getMessage());
			return $e->getMessage();
		}
	}

	
	static function insert($queryString){
		try {
			return DB::insert($queryString);
		} catch (\Exception $e) {
			LogsDao::nuevo("Error->".__FUNCTION__,$e->getMessage());
			return $e->getMessage();
		}
	}
	
	static function insertLog($queryString){
		try {
			return DB::insert($queryString);
		} catch (\Exception $e) {
			return $e->getMessage();
		}
	}
	
	static function update($queryString){
		try {
			return DB::statement($queryString);
		} catch (\Exception $e) {
			LogsDao::nuevo("Error->".__FUNCTION__,$e->getMessage());
			return $e->getMessage();
		}
	}
	
	static function delete($queryString){
		try {
			return DB::delete($queryString);
		} catch (\Exception $e) {
			LogsDao::nuevo("Error->".__FUNCTION__,$e->getMessage());
			return $e->getMessage();
		}
	}
}

?>